<template>
	<div>
		<div class="head">
			<router-link tag="div" class="return" to="/Setting"></router-link>
			安全设置
		</div>
		<div class="overlay">
			<div class="overlay-content scrolling">
				<group label-width="9.5em" label-margin-right="2em" style="margin-top:10px;">
					<cell title="登录密码" is-link class="l-orange" link="/Safety"></cell>
					<cell title="支付密码" is-link class="l-orange" @click.native="tradePass"></cell>
				</group>
			</div>
		</div>
	</div>
</template>

<script>
	import { safety } from './../../utils/api';
	export default {
		methods: {
			tradePass() { //支付密码
				safety.getTransaction().then(res => { // 判断是还是设置支付密码
					if(res.data) { //当true为已设置支付密码
						this.nextUpdatePayPassword();
					} else {
						this.nextAddPayPassword();
					}
				})
			},
			nextUpdatePayPassword() { // 修改支付密码
				this.$router.push({
					path: '/Safety',
					query: {
						type: 0
					}
				});
			},
			nextAddPayPassword() { // 设置支付密码
				this.$router.push({
					path: '/Safety',
					query: {
						type: 1
					}
				});
			}
		}
	}
</script>

<style lang="less" scoped>

</style>